import React, { useState,  }  from 'react';
import { RouterProvider } from 'react-router-dom';
import router from '@/router/index';
import { ConfigProvider, theme } from 'antd';
import ThemeContext from './theme/ThemeContext';
import { AuthProvider } from '@/contexts/AuthContext';
function App() {
  const [appTheme, setAppTheme] = useState('light');
  const themeConfig = {
    algorithm: appTheme === 'light' ? theme.defaultAlgorithm : theme.darkAlgorithm
  };
  return (
    <ThemeContext.Provider value={{ theme: appTheme, setTheme: setAppTheme }}>
      <ConfigProvider theme={themeConfig}>
        <AuthProvider>
          <RouterProvider router={router} />
        </AuthProvider>
      </ConfigProvider>
    </ThemeContext.Provider>
  );
}

export default App;